<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                template="/template/OutletManagementTemplate.xhtml">

    <ui:define name="contentInsert">

        <h:form id="form_purchaseRedeem">
                                                <br/>
                                                <br/>
                                                Input Customer Email: <p:inputText value="#{outletManagerIOTRManagedBean.customerEmail}"/>  <p:commandButton value="Get Purchases" action="OutletManager/IOTR_PurchaseRedemption.xhtml" ajax="false"/>
                                                <br/>
                                                <br/>
                                                <p:dataTable value="#{outletManagerIOTRManagedBean.getPurchasedItem()}" var="o"
                                                     styleClass="order-table-shoppingcart"
                                                     rowStyleClass="contentbox"
                                                     emptyMessage="No Outstanding purchases"
                                                     >
                                                        

                                                    <p:column style="width: 10px">
                                                        <f:facet name="header">Purchase Date</f:facet>
                                                        #{o.time_stamp.time}
                                                    </p:column>
                                                    
                                                    
                                                    <p:column style="width: 50px">
                                                        <f:facet name="header">Outlet</f:facet>
                                                        #{o.outlet_name}
                                                    </p:column>

                                                    <p:column style="width: 80px">
                                                        <f:facet name="header">Item Name</f:facet>
                                                        <h:outputText value="#{o.item_name}" escape="false"/>
                                                        
                                                    </p:column>

                                                    <p:column style="width: 40px">
                                                        <f:facet name="header">Quantity</f:facet>
                                                        #{o.quantity}
                                                    </p:column>
                                                    
                                                    <p:column style="width: 40px">
                                                        <f:facet name="header">Subtotal</f:facet>
                                                        #{o.subtotal}
                                                    </p:column>
                                                    
                                                    <p:column style="width: 50px">                    
                                                        <p:commandButton value="Redeem" action="#{outletManagerIOTRManagedBean.redeemPurchases(o.id)}" ajax="false"/>
                                                    </p:column>

                                                </p:dataTable>

                                        </h:form> 
    </ui:define>
</ui:composition>
